﻿using System.Collections.Generic;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
using Entities;
using System;
using System.Linq;

namespace WebUI.Areas.Bots.Models
{
    public class BotFilters
    {
        [RegularExpression("^[0-9]+$", ErrorMessage = "Please enter correct value")]
        public int? MinOpsCount { get; set; }

        [RegularExpression("^[0-9]+$", ErrorMessage = "Please enter correct value")]
        public long? MinFileSize { get; set; }

        public string Path { get; set; }

        public string FileDirectoryName { get; set; }

        public string FileExtension { get; set; }

        public bool AllHours { get; set; }

        public IEnumerable<SelectListItem> Sizes
        {
            get
            {
                return Enum
                    .GetValues(typeof(SizesEnum))
                    .Cast<SizesEnum>()
                    .Select
                   (e => new SelectListItem { Text = e.ToString(), Value = ((int)e).ToString() });
            }
        }

        [RegularExpression("^[0-9]+$", ErrorMessage = "Please enter correct value")]
        public int SelectedSize { get; set; }

        string _periodHours;
        public string PeriodHours
        {
            get
            {
                if (_periodHours == null)
                {
                    return string.Empty;
                }

                return _periodHours;
            }
            set
            {
                _periodHours = value;
            }
        }
    }
}